<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>管理员列表-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="/static/css/font.css">
		<link rel="stylesheet" href="/static/css/weadmin.css">
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
	      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
        <style>
            .layui-table-cell {
                height:50px !important;
                line-height: 50px;
				text-align: center;
            }
        </style>
	</head>

	<body>
		<div class="weadmin-nav">
			<span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">管理员管理</a>
        <a>
          <cite>管理员列表</cite></a>
      </span>
			<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
				<i class="layui-icon" style="line-height:30px">ဂ</i></a>
		</div>
		<div class="weadmin-body">
			<div class="layui-row">
				<form class="layui-form layui-col-md12 we-search">
					<div class="layui-inline">
						<input class="layui-input" placeholder="开始日" name="start" id="start">
					</div>
					<div class="layui-inline">
						<input class="layui-input" placeholder="截止日" name="end" id="end">
					</div>
					<div class="layui-inline">
						<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
				</form>
			</div>
			<div class="weadmin-block">
				<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
				<button class="layui-btn" onclick="WeAdminShow('添加用户','./add.html')"><i class="layui-icon"></i>添加</button>
				<span class="fr" style="line-height:40px" >共有数据 <span id="count"></span> 条</span>
			</div>
			<table id="demo" class="layui-table">
				
				
			</table>
		</div>
		<script src="/lib/layui/layui.js" charset="utf-8"></script>
		<script src="/static/js/eleDel.js" type="text/javascript" charset="utf-8"></script>

<script>
	layui.use(['table','jquery'], function () {
		var $=layui.jquery;
		var table = layui.table;

		//第一个实例
		table.render({
			elem: '#demo',
			height: 312,
			url: '/admin/manager/adminList' //数据接口
				,
			page: true //开启分页
				,
			cols: [
				[ //表头
					{
						field: 'checked',
						title: '复选框',
						type: 'checkbox',
						fixed: 'left',
						width: 80
					},
					{
						field: 'id',
						title: 'ID',
						width: 70
					}, {
						field: 'username',
						title: '用户名'
					}, {
						field: 'mobile',
						title: '手机'
					}, {
						field: 'email',
						title: '邮箱'
					}, {
						field: 'roleid',
						title: '角色',templet: function(d){//函数返回一个参数 d，包含接口返回的所有字段和数据
						let val="";  
						if(d.sex=="0"){
							val="男"
						}else{
							val="女"
						}
						return val;
					}}
					, {
						field: 'imgheader',
						title: '头像',
						templet:'#imgheader'
					}, {
						field: 'wealth',
						title: '操作',
						templet:'#caozuo'
					}
				]
			]
			,done: function(res, curr, count){
				//如果是异步请求数据方式，res即为你接口返回的信息。
				//如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
				console.log(res);//{code: ,data:[],msg: ,count:
				//得到当前页码
				console.log(curr); 
				//得到数据总量
				console.log(count);
				$('.weadmin-block #count').html(count)
			}
		});

	});
</script>
<script type="text/html" id="imgheader">
	{{#  if(d.imgheader){ }}
		<img src="{{d.imgheader}}" style="width:50px;height:50px;" >
	{{#  } else { }}
		<img src="https://img.zcool.cn/community/01c8415b10ec7aa801212d57334fdc.png@1280w_1l_2o_100sh.png" style="width:100px;height:100px;" >
	{{#  } }}
	
</script>

<script type="text/html" id="caozuo">
	<a title="查看" onclick="WeAdminShow('查看','/admin/user/userLIst/detail?id={{d.id}}')" href="javascript:;">
		<i class="layui-icon" style="font-size: 18px;">&#xe63c;</i>
	</a>
	<a title="编辑" onclick="WeAdminShow('编辑','/admin/user/userLIst/edit?id={{d.id}}')" href="javascript:;">
		<i class="layui-icon" style="font-size: 18px;">&#xe642;</i>
	</a>
	<a title="删除" onclick="userdel(this,'{{d.id}}')" href="javascript:;">
		<i class="layui-icon" style="font-size: 18px;">&#xe640;</i>
	</a>
</script>

</body>

</html>